import request from '@/utils/request';
import type { AxiosPromise } from '@/utils/request';
import type { BuyApplyVO, BuyApplyForm, BuyApplyQuery } from '@/pagesA/api/workflow/buyApply/types';

/**
 * 查询采购请购列表
 * @param query
 * @returns {*}
 */

export const listBuyApply = (query?: BuyApplyQuery): AxiosPromise<BuyApplyVO[]> => {
  return request({
    url: '/workflow/buyApply/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询采购请购详细
 * @param id
 */
export const getBuyApply = (id: string | number): AxiosPromise<BuyApplyVO> => {
  return request({
    url: '/workflow/buyApply/' + id,
    method: 'get'
  });
};

/**
 * 新增采购请购
 * @param data
 */
export const addBuyApply = (data: BuyApplyForm) => {
  return request({
    url: '/workflow/buyApply',
    method: 'post',
    data: data
  });
};

/**
 * 修改采购请购
 * @param data
 */
export const updateBuyApply = (data: BuyApplyForm) => {
  return request({
    url: '/workflow/buyApply',
    method: 'put',
    data: data
  });
};

/**
 * 删除采购请购
 * @param id
 */
export const delBuyApply = (id: string | number | Array<string | number>) => {
  return request({
    url: '/workflow/buyApply/' + id,
    method: 'delete'
  });
};
